import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider_demo/model/somemodel.dart';

class ModelRatingBar extends StatelessWidget {
  final SomeModel model;

  const ModelRatingBar({Key key, this.model}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.center,
      mainAxisSize: MainAxisSize.min,
      children: <Widget>[
        FlutterRatingBar(
          initialRating: model.rating,
            fillColor: Colors.amber,
            borderColor: Colors.amber.withAlpha(50),
            allowHalfRating: true,
            ignoreGestures: true,
            onRatingUpdate: null,
            itemCount: 5,
            itemSize: 28,
        ),
        SizedBox(width: 12,),
        Text(model.rating.toString(),
          style: TextStyle(fontSize: 24,color: Colors.amber,fontWeight: FontWeight.w600),)
      ],
    );
  }
}
